Skip to content

Add pre-release/RC version filtering to update.ps1#3039

Merged
DRSDavidSoft merged 5 commits intomasterfrom
copilot/exclude-rc-versions-update-script
Nov 7, 2025
Merged

Add pre-release/RC version filtering to update.ps1#3039
DRSDavidSoft merged 5 commits intomasterfrom
copilot/exclude-rc-versions-update-script

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 7, 2025

This PR implements filtering of release candidate (RC) and pre-release versions in the scripts/update.ps1 script to ensure only stable releases are used when updating dependencies.

Changes Made

1. Added -IncludePrerelease Parameter

  • New switch parameter (default: $false) to control whether pre-release versions should be included
  • Allows maintainers to override filtering behavior when needed

2. Created Test-IsPrerelease Helper Function

  • Centralized pre-release detection logic that checks:
    • GitHub's prerelease boolean flag from the API response
    • Common pre-release keywords in version tag names: -rc, -beta, -alpha, -preview, -pre
  • Case-insensitive keyword matching for broad coverage

3. Updated Fetch-DownloadUrl Function

  • Now accepts $includePrerelease parameter
  • Applies filtering consistently in both:
    • Main release iteration loop
    • Archive download special case

4. Added Verbose Logging

  • Shows which versions are being skipped during the update process
  • Helps with debugging and transparency

5. Documentation

  • Clear comments explain the filtering behavior and keywords being checked
  • Function-level documentation for the new helper

How It Works

By default, the script now filters out all pre-release versions, ensuring only stable releases are selected:

  • Checks GitHub's prerelease flag from the releases API
  • Scans tag names for common pre-release identifiers (case-insensitive)
  • Filtering is applied consistently throughout the script

Example behavior:

  • Before: Would pick up v2.50.0-rc for Git for Windows ❌
  • After: Will skip v2.50.0-rc and use the latest stable version like v2.49.0

Override option: Maintainers can pass -IncludePrerelease when running the script to include pre-releases if needed.

GitHub Actions workflow: The existing workflow will automatically use the default behavior (stable only) without requiring any changes.

Testing

  • ✅ PowerShell syntax validation passed
  • ✅ Filtering logic tested with mock data
  • ✅ Code review completed with all suggestions addressed
  • ✅ No code duplication - logic centralized in helper function

Benefits

  • Maintainers no longer need to manually revert RC updates grabbed accidentally
  • Ensures more stable CI/CD pipeline upgrades and package distribution
  • Simple, maintainable implementation with clear documentation

Fixes #3038

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature request] Exclude Release Candidate (e.g. -rc) versions when updating dependencies with vendor update script</issue_title>
<issue_description>### Suggestion

Feature: Update the scripts/update.ps1 script so that when the GitHub Action Update Vendor is triggered and the vendor/sources.json file is updated, it ignores certain keywords such as -rc (release candidate) in dependency version names, for example, for Git for Windows. This ensures that only the latest stable (non-RC) releases are used during the update process.

Rationale: The current script sometimes picks up release candidate versions (like -rc in Git for Windows) when updating dependencies, which may not be desired for all users. We'd like to ensure the script only updates to stable releases by default.

Context: This need was raised in response to this PR comment and relates specifically to automating vendor updates in a more reliable way for everyday users and automation workflows.

Scope:

  • Modify the dependency version selection logic in scripts/update.ps1.
  • During the update process, the script should skip over pre-release, RC, or other flagged test versions, focusing on stable versions only (e.g. for Git for Windows, and extensible for others if needed).
  • Clearly document in the script comments what keywords (e.g. RC in this case) is being skipped.
  • Keep the workflow simple and robust for maintainers.

Use case

  • Running the Update Vendor GitHub Action will only upgrade dependencies to stable versions (e.g., skips v2.50.0-rc for Git for Windows, only picks up v2.49.0 or the next non-RC version).
  • Maintainers do not need to manually revert RC updates if grabbed accidentally.
  • Ensures more stable CI/CD pipeline upgrades and package distribution.

Extra info/examples/attachments

Reference: PR cmderdev/cmder#3003. Comments highlighted why grabbing an RC version caused confusion or extra work.

By default, avoid RC/pre-releases unless the list is explicitly overridden by a switch/variable when invoked.

Implementation should be clear, simple, and aimed at maintainability.

Checklist

  • I have read the documentation and made sure this feature doesn't already exist.
  • I have searched for similar issues and found none that describe my feature request.</issue_description>

<agent_instructions>Read the issue, apply updates to the specified PS1 script to implement this in the best certain way. Keep it simple. Explain in detail how the change works in the generated PR.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits November 7, 2025 14:35
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 7, 2025

@copilot Please try-again

I've implemented the RC/pre-release filtering feature. The changes include:

  • Added -IncludePrerelease parameter (default: false) to control filtering behavior
  • Created Test-IsPrerelease helper function to detect pre-releases via GitHub's API flag and keywords (-rc, -beta, -alpha, -preview, -pre)
  • Applied filtering consistently throughout the script, including the archive download special case
  • Added verbose logging to show skipped versions

By default, the script now only picks up stable releases. The GitHub Actions workflow will automatically benefit from this without any changes needed.

Commits: 7373940, aa6b28a, d01ab39, a513d08

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/git-for-windows/git/releases
    • Triggering command: curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update update.ps1 to exclude release candidate versions Add pre-release/RC version filtering to update.ps1 Nov 7, 2025
@DRSDavidSoft DRSDavidSoft marked this pull request as ready for review November 7, 2025 14:54
@DRSDavidSoft
Copy link
Copy Markdown
Contributor

LGTM 👍🏻

@DRSDavidSoft DRSDavidSoft merged commit 8ab1f11 into master Nov 7, 2025
6 checks passed
@DRSDavidSoft DRSDavidSoft deleted the copilot/exclude-rc-versions-update-script branch November 7, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] Exclude Release Candidate (e.g. -rc) versions when updating dependencies with vendor update script

2 participants